<script src="/assets/public/layermobile/layer.js"></script>
<script src="/assets/base/chargingdataAgent/js/jquery-2.1.0.min.js"></script>
<script src="/assets/base/chargingdataAgent/js/mobiscroll.custom-3.0.0-beta2.min.js"></script>
<script src="/assets/base/chargingdataAgent/js/highcharts.js"></script>
<script>
    window.fm = {};
    fm.alert = function (msg, style, time, end) { //layer  alert  弹出提示 2秒后自动关闭
        layer.closeAll();
        layer.open({
            content: msg,
            style: style || 'background-color:#27a7e4; text-align:center;color:#fff; border:none;',
            time: time || 1,
            end: end || function () {

            }
        });
    };

    fm.confirm = function (msg,callback) {
        layer.closeAll();
        layer.open({
            content: msg,
//                style: style || 'width: 50%;',
            btn: ['确认', '取消'],
            shadeClose: false,
            yes: function(){
                callback(1);
            }, no: function(){
                callback(0);
            }
        });
    };

    fm.showLoging = function (text) { //显示加载中
        layer.closeAll();
        var logIndex = layer.open({
            type: 2,
            shadeClose: false,
            content: text || '加载中...'
        });
        setTimeout(function () {
            layer.close(logIndex);
        }, 15000);
    }

    fm.closeLayer = function (times) { //关闭加载中
        if (times) {
            setTimeout(function () {
                layer.closeAll();
            }, times * 500);
        } else {
            layer.closeAll();
        }
    }
</script>
